{% extends 'base.html' %}
{% block body %}
    <div class="layui-container">
        <div class="layui-col-md8 layui-col-md-offset2">
            {% if newest_article_list %}
            {% for article in newest_article_list %}
                <div class="layui-card layui-col-md6 layui-col-md-offset3">
                    <div class="layui-card-header">
                        <h2><a href="{% url 'article:detail' article.id %}">{{ article.title }}</a></h2>
                    </div>
                    <div class="layui-card-body">
                        <img src="/media/{{ article.coverImage }}" alt="" height="200px">
                        <h3>{{ article.title }}</h3>
                        {{ article.author }} {{ article.createTime }}
                        {% if article.Category %}
                            <a href="{% url 'article:category' article.Category.id %}">{{ article.Category.category }}</a>
                        {% endif %}
                    </div>
                </div>
            {% endfor %}
            {% else %}
                <div class="layui-panel">
                    <i class="layui-icon layui-icon-face-cry layui-c" style="font-size: 30px;"></i><p>没有发布文章</p>
                </div>
            {% endif %}
            <br><br><br>
            <button type="button" class="layui-btn layui-bg-blue layui-col-md2 layui-col-md-offset5"><a href="{% url 'article:index' %}">查看全部</a></button>
        </div>
    </div>
{% endblock %}